Fix bug where insert-file-contents closes a file twice.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 16 Jul 2013 21:49:32 +0000 (14:49 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 16 Jul 2013 21:49:32 +0000 (14:49 -0700)
commit2a1928e69456b006c83578970084957fc503966a
tree4972e37dd0554fa0dde4cbac5645e13319242355
parent63f294b9e94983adff760eb2118510c8b96ddc74
Fix bug where insert-file-contents closes a file twice.

* fileio.c (close_file_unwind): Don't close if FD is negative;
this can happen when unwinding a zapped file descriptor.
(Finsert_file_contents): Unwind-protect the fd before the point marker,
in case Emacs runs out of memory between the two unwind-protects.
Don't trash errno when closing FD.
Zap the FD in the specpdl when closing it, instead of deferring
the removal of the unwind-protect; this fixes a bug where a child
function unwinds the stack past us.
src/ChangeLog
src/fileio.c
src/lisp.h